//
//  MBOrderNetTool.m
//  MemberBusiness-ios
//
//  Created by cherry pu on 2018/4/25.
//  Copyright © 2018年 zhangXin. All rights reserved.
//

#import "MBOrderNetTool.h"


@implementation MBOrderNetTool

+(void)netToolPostOrderListParam:(MBOrderListParam*)param success:(MBResponseBlock)response failure:(MBRequestFailure)failure
{
    NSMutableDictionary* dic = param.yy_modelToJSONObject;
    if (param.order_status < 0) {
        [dic removeObjectForKey:@"order_status"];
    }

    [[MBHTTPTool sharedInstance]POST:ACCOUNT_ORDER_ORDER_LIST params:dic success:^(id jsonData) {
        response([[MBHTTPResponse alloc]initWithJsonData:jsonData]);
    } failure:^(NSError *error) {
        failure(error);
    }];
}

+(void)netToolPostStoreShippingStoreId:(NSInteger)storeId success:(MBResponseBlock)response failure:(MBRequestFailure)failure
{
    MBLoginUserModel* userModel = [MBLoginUserModelArchieveTool userInfoUnAchieveFromFile];
    if (!userModel) {
        return;
    }
    [[MBHTTPTool sharedInstance]POST:ACCOUNT_ORDER_STORE_SHIPPING params:@{@"store_id":@(storeId),@"token":userModel.token} success:^(id jsonData) {
        response([[MBHTTPResponse alloc]initWithJsonData:jsonData]);
    } failure:^(NSError *error) {
        failure(error);
    }];
}

+(void)netToolPostOrderConfirmParam:(MBOrderConfirmParam*)param success:(MBResponseBlock)response failure:(MBRequestFailure)failure
{
    [[MBHTTPTool sharedInstance]POST:ACCOUNT_ORDER_SELLER_CONFIRM params:param.yy_modelToJSONObject success:^(id jsonData) {
        response([[MBHTTPResponse alloc]initWithJsonData:jsonData]);
    } failure:^(NSError *error) {
        failure(error);
    }];
}


+(void)netToolPostOrderDeliveryHandleParam:(MBOrderConfirmParam*)param success:(MBResponseBlock)response failure:(MBRequestFailure)failure
{
    [[MBHTTPTool sharedInstance]POST:ACCOUNT_ORDER_SELLER_HANDLE params:param.yy_modelToJSONObject success:^(id jsonData) {
        response([[MBHTTPResponse alloc]initWithJsonData:jsonData]);
    } failure:^(NSError *error) {
        failure(error);
    }];
}



+(void)netToolPostOrderGroupListParam:(MBOrderListParam*)param success:(MBResponseBlock)response failure:(MBRequestFailure)failure
{
    NSMutableDictionary* dic = param.yy_modelToJSONObject;
    if (param.order_status < 0) {
        [dic removeObjectForKey:@"order_status"];
    }
    
    [[MBHTTPTool sharedInstance]POST:ACCOUNT_ORDER_GROUP_LIST params:dic success:^(id jsonData) {
        response([[MBHTTPResponse alloc]initWithJsonData:jsonData]);
    } failure:^(NSError *error) {
        failure(error);
    }];
}


@end
